[WEB-8] [EDITOR] Basic Delete Block Functionality#341
Open
josh-ramos-22 wants to merge 15 commits intomainfrom
Open
[WEB-8] [EDITOR] Basic Delete Block Functionality#341josh-ramos-22 wants to merge 15 commits intomainfrom
josh-ramos-22 wants to merge 15 commits intomainfrom
Conversation
added 15 commits
March 8, 2023 20:36
lauraw0
suggested changes
Apr 6, 2023
Contributor
There was a problem hiding this comment.
you can move this entire component into frontend/src/cse-ui-kit/DeleteBlock_button/index.ts That way there isn't a need for an empty file with a singular import :D
Contributor
Author
There was a problem hiding this comment.
Currently this doesn't work since index.ts is a ts file instead of a tsx file :/
All of the existing Button components in cse-ui-kit (eg CreateContentBlock, CreateHeadingBlock) have an similar index.ts file with a single import.
Should I change the file to index.tsx? Or keep it consistent with the other button components?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why are the changes needed?
Currently there is no way for a user to delete a content or heading block from the editor. Adding this functionality enables users to rollback on mistakes and format more easily.
Changes
frontend/src/packages/editor/index.tsxBlockWrapperandBlockContainerin order to properly format the delete button with its corresponding block.deleteButtonClickHandler, which deletes the block that its caller is associated with.deletionOperationfor future OT integration.frontend/src/packages/editor/types.tskeyattribute toCustomElement,CustomText, andCMSBlockProps. Thiskeyis only used to allow a block to know when to re-render its value when a block above it is deleted.In
frontend/src/cse-ui-kit/DeleteBlock, the button used to delete a corresponding block.Screenshots
When 'X' button is hovered over


When
Xbutton is not hovered overComments
While this implementation is currently working, there are still things to be done to refine and improve:
DeleteBlockcomponent -DeleteBlock.stories.tsxis currently just a stub file. Need to research what a story is used for and how to implement one -> DONE (16/03/23 6:42pm)keygeneration - Currently the key for each block is just generated withMath.random(). While this produces unique enough keys for our needs, it would be good to use a more robust method such asuuid(currentlyuuidis failing to import, still investigating why).